< previous page page_421 next page >

Page 421
TABLE 15.5. CONSTANTS FOR THEEffectsARGUMENT.
ConstantValueDescription
vbDropEffectNone0Drop target cannot accept the data.
vbDropEffectCopy1Drop results in a copy. The original data is untouched by the drag source.
vbDropEffectMove2Drag source removes the data.
vbDropEffectScroll&H80000000&Scrolling is about to start or is currently occurring in the target.

The state argument enables you to respond to the source data entering, passing over, and leaving the target control. As an example, when the source data is dragged onto the target control, the state argument is set to vbEnter. The constants listed in Table 15.6 are used to check the value of the state argument.
TABLE 15.6. CONSTANTS USED TO CHECK THE STATE ARGUMENT.
ConstantValueDescription
vbEnter0Data was dragged within the range of a target.
vbLeave1Data was dragged out of the range of a target.
vbOver2Data is still within the range of a target, and either the mouse has moved, a mouse or keyboard button has changed, or a certain system-determined amount of time has elapsed.

The code in Listing 15.3 checks the format of the data being dragged over a control and if it is compatible and the data is dropped, a move operation is requested. However, if the data isn't compatible, the effect argument is set to None and a No Drop mouse pointer is displayed.
LISTING 15.3 DRAGOVER.TXTCHECKING THE DATA FORMAT AND SETTING THE OPERATIONS ALLOWED.

8694cbadb9b1ef7075903f6f95fc1db2.gif
1: Private Sub txtTarget_OLEDragOver(Data As VB.DataObject, Effect As Long,_
2: Button As _
3:     Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
4:     If Data.GetFormat(vbCFText) Then
5:         Effect = vbDropEffectMove And Effect
6:     Else
7:         Effect = vbDropEffectNone
8:     End If
9: End Sub

 
< previous page page_421 next page >

If you like this book, buy it!